67da06
@@ -77,8 +77,16 @@
public class RESTServer implements Constants {
   public static void main(String[] args) throws Exception {
     Log LOG = LogFactory.getLog("RESTServer");
 
-	VersionInfo.logVersion();
+    VersionInfo.logVersion();
     Configuration conf = HBaseConfiguration.create();
+    // login the server principal (if using secure Hadoop)   
+    if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
+      String machineName = Strings.domainNamePointerToHostName(
+        DNS.getDefaultHost(conf.get("hbase.rest.dns.interface", "default"),
+          conf.get("hbase.rest.dns.nameserver", "default")));
+      User.login(conf, "hbase.rest.keytab.file", "hbase.rest.kerberos.principal",
+        machineName);
+    }
     RESTServlet servlet = RESTServlet.getInstance(conf);
 
     Options options = new Options();
@@ -170,15 +178,6 @@
public class RESTServer implements Constants {
     context.addServlet(sh, "/*");
     context.addFilter(GzipFilter.class, "/*", 0);
 
-    // login the server principal (if using secure Hadoop)   
-    if (User.isSecurityEnabled() && User.isHBaseSecurityEnabled(conf)) {
-      String machineName = Strings.domainNamePointerToHostName(
-        DNS.getDefaultHost(conf.get("hbase.rest.dns.interface", "default"),
-          conf.get("hbase.rest.dns.nameserver", "default")));
-      User.login(conf, "hbase.rest.keytab.file", "hbase.rest.kerberos.principal",
-        machineName);
-    }
-
     // Put up info server.
     int port = conf.getInt("hbase.rest.info.port", 8085);
     if (port >= 0) {
